/******************************************************************************

	COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2010.

	This file is part of the Maxsi Library.

	Maxsi Library is free software: you can redistribute it and/or modify it
	under the terms of the GNU Lesser General Public License as published by
	the Free Software Foundation, either version 3 of the License, or (at your
	option) any later version.

	Maxsi Library is distributed in the hope that it will be useful, but
	WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
	or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
	License for more details.

	You should have received a copy of the GNU Lesser General Public License
	along with Maxsi Library. If not, see <http://www.gnu.org/licenses/>.

	Maxsi Library
	A powerful Cross-Platform C++ General Purpose Library that allows you to
	efficiently create high-performance and reliable applications.

	MaxsiWindowW32.h
	Implements the MaxsiWindowSystem using the W32 platform.

******************************************************************************/

#ifndef MaxsiWindowW32_H
#define MaxsiWindowW32_H

BeginMaxsiNamespace

#ifdef Maxsi_Enable_Non_Namespaced_Macros
#ifdef Maxsi_Using_Unicode_Internally

	#define MessageBoxM MessageBoxW
	#define SetWindowTextM SetWindowTextW
	#define DefWindowProcM DefWindowProcW
	#define CreateFontM CreateFontW
	#define LoadImageM LoadImageW
	#define RegisterClassM RegisterClassW
	#define GetMessageM GetMessageW
	#define DispatchMessageM DispatchMessageW
	#define CreateWindowM CreateWindowW
	#define SendMessageM SendMessageW

#else

	#define MessageBoxM MessageBoxA
	#define SetWindowTextM SetWindowTextA
	#define DefWindowProcM DefWindowProcA
	#define CreateFontM CreateFontA
	#define LoadImageM LoadImageA
	#define RegisterClassM RegisterClassA
	#define GetMessageM GetMessageA
	#define DispatchMessageM DispatchMessageA
	#define CreateWindowM CreateWindowA
	#define SendMessageM SendMessageA

#endif
#endif

//=============================================================================
//	Forward declarations.
//=============================================================================
class	MaxsiWindowW32;
class	MaxsiWindowSystemW32;

//=============================================================================
//	Define where the MaxsiWindowSystemW32 interface is declared.
//=============================================================================
#undef MAXSI_INTERFACE
#define MAXSI_INTERFACE MAXSI_INTERFACE_IMPLEMENTED_IN_MAXSI_LIBRARY

//=============================================================================
//	Declare the MaxsiWindowSystemW32 interface.
//=============================================================================
MAXSI_CLASSLINK MaxsiWindowSystemW32 : public MaxsiWindowSystem
{
	MAXSI_DECLARE_IMPLEMENTATION(MaxsiWindowSystemW32, MaxsiWindowSystem, MAXSI_INTERFACE_STATIC);

public:
	HFONT DefaultFont;
	HFONT DefaultFontBold;
	HFONT DefaultFontLabel;
	HFONT DefaultFontButton;

public:
	MaxsiWindowSystemW32();
	virtual ~MaxsiWindowSystemW32();

public:
	virtual int Initialize(int* argc, char** argv[]) MAXSI_INTERFACE;
	virtual void ShutDown() MAXSI_INTERFACE;
	virtual int MainLoop() MAXSI_INTERFACE;
	virtual MaxsiWindow* CreateWindow(MaxsiWindow* Parent, MESTR* ClassName, int Width, int Height, int Left, int Top, MESTR* Title) MAXSI_INTERFACE;
	virtual void DeleteWindow(MaxsiWindow* Window) MAXSI_INTERFACE;
	virtual int MsgBox(MaxsiHandle Parent, int Flags, MESTR* Message, MESTR* Title) MAXSI_INTERFACE;
	virtual MaxsiError PostEventThreaded(MaxsiWindowEvent* Event) MAXSI_INTERFACE;
	
};

//=============================================================================
//	Define where the MaxsiControl interface is declared.
//=============================================================================
#undef MAXSI_INTERFACE
#define MAXSI_INTERFACE MAXSI_INTERFACE_IMPLEMENTED_IN_MAXSI_LIBRARY

//=============================================================================
//	Declare the MaxsiWindow interface.
//=============================================================================
MAXSI_CLASSLINK MaxsiWindowW32 : public MaxsiWindow
{
	MAXSI_DECLARE_IMPLEMENTATION(MaxsiWindowW32, MaxsiWindow, MAXSI_INTERFACE_DYNAMIC);

public:
	MaxsiWindowW32();
	virtual ~MaxsiWindowW32();	

public:
	virtual MaxsiError Initialize(MaxsiWindow* Parent, MESTR* ClassName, int Width, int Height, int Left, int Top, MESTR* Title) MAXSI_INTERFACE;
	virtual MaxsiError Destroy() MAXSI_INTERFACE;
	virtual MaxsiError Become(MaxsiWindow* NewSelf) MAXSI_INTERFACE;
	virtual MaxsiError OnEvent(MaxsiWindowEvent* Event) MAXSI_INTERFACE;
	virtual MaxsiError Show() MAXSI_INTERFACE;
	virtual MaxsiError Hide() MAXSI_INTERFACE;
	virtual void SetEventHandler(MaxsiWindowEventHandler Handler) MAXSI_INTERFACE;
	virtual MaxsiWindow* CreateChild(MESTR* ClassName, int Width, int Height, int Left, int Top, MESTR* Title) MAXSI_INTERFACE;
	virtual MESTR* GetControlType() MAXSI_INTERFACE;
	virtual int Left() MAXSI_INTERFACE;
	virtual int Top() MAXSI_INTERFACE;
	virtual int Width() MAXSI_INTERFACE;
	virtual int Height() MAXSI_INTERFACE;
	virtual int Right() MAXSI_INTERFACE;
	virtual int Bottom() MAXSI_INTERFACE;
	virtual MaxsiError Move(int NewLeft, int NewTop, int NewWidth, int NewHeight) MAXSI_INTERFACE;
	virtual MaxsiError SetProgress(float Progress, int Type) MAXSI_INTERFACE;
	virtual MaxsiError SetText(MESTR* NewText) MAXSI_INTERFACE;
	virtual MaxsiError SetFont(MaxsiHandle NewFont) MAXSI_INTERFACE;
	virtual MESTR* GetText() MAXSI_INTERFACE;
	
};

//=============================================================================
//	Define where the MaxsiBaseControlW32 interface is declared.
//=============================================================================
#undef MAXSI_INTERFACE
#define MAXSI_INTERFACE MAXSI_INTERFACE_IMPLEMENTED_IN_MAXSI_LIBRARY

//=============================================================================
//	Declare the MaxsiBaseControlW32 interface.
//=============================================================================
MAXSI_CLASSLINK MaxsiBaseControlW32 : public MaxsiWindow
{
	MAXSI_DECLARE_CHILD_CLASS(MaxsiBaseControlW32, MaxsiWindow);

public:
	MaxsiBaseControlW32();
	virtual ~MaxsiBaseControlW32();

public:
	virtual MaxsiError Destroy() MAXSI_INTERFACE;
	virtual MaxsiError OnEvent(MaxsiWindowEvent* Event) MAXSI_INTERFACE;
	virtual MaxsiError Show() MAXSI_INTERFACE;
	virtual MaxsiError Hide() MAXSI_INTERFACE;
	virtual void SetEventHandler(MaxsiWindowEventHandler Handler) MAXSI_INTERFACE;
	virtual MaxsiWindow* CreateChild(MESTR* ClassName, int Width, int Height, int Left, int Top, MESTR* Title) MAXSI_INTERFACE;
	virtual int Left() MAXSI_INTERFACE;
	virtual int Top() MAXSI_INTERFACE;
	virtual int Width() MAXSI_INTERFACE;
	virtual int Height() MAXSI_INTERFACE;
	virtual int Right() MAXSI_INTERFACE;
	virtual int Bottom() MAXSI_INTERFACE;
	virtual MaxsiError Move(int NewLeft, int NewTop, int NewWidth, int NewHeight) MAXSI_INTERFACE;
	virtual MaxsiError SetProgress(float Progress, int Type) MAXSI_INTERFACE;
	virtual MaxsiError SetText(MESTR* NewText) MAXSI_INTERFACE;
	virtual MaxsiError SetFont(MaxsiHandle NewFont) MAXSI_INTERFACE;
	virtual MESTR* GetText() MAXSI_INTERFACE;
	
};

//=============================================================================
//	Define where the MaxsiButtonW32 interface is declared.
//=============================================================================
#undef MAXSI_INTERFACE
#define MAXSI_INTERFACE MAXSI_INTERFACE_IMPLEMENTED_IN_MAXSI_LIBRARY

//=============================================================================
//	Declare the MaxsiButtonW32 interface.
//=============================================================================
MAXSI_CLASSLINK MaxsiButtonW32 : public MaxsiBaseControlW32
{
	MAXSI_DECLARE_IMPLEMENTATION(MaxsiButtonW32, MaxsiWindow, MAXSI_INTERFACE_DYNAMIC);

public:
	MaxsiButtonW32();
	virtual ~MaxsiButtonW32();

public:
	virtual MaxsiError Initialize(MaxsiWindow* Parent, MESTR* ClassName, int Width, int Height, int Left, int Top, MESTR* Title) MAXSI_INTERFACE;
	virtual MaxsiError Become(MaxsiWindow* NewSelf) MAXSI_INTERFACE;
	virtual MaxsiError SetText(MESTR* NewText) MAXSI_INTERFACE;
	virtual MaxsiError SetFont(MaxsiHandle NewFont) MAXSI_INTERFACE;
	virtual MESTR* GetControlType() MAXSI_INTERFACE;
	
};

//=============================================================================
//	Define where the MaxsiButtonW32 interface is declared.
//=============================================================================
#undef MAXSI_INTERFACE
#define MAXSI_INTERFACE MAXSI_INTERFACE_IMPLEMENTED_IN_MAXSI_LIBRARY

//=============================================================================
//	Declare the MaxsiProgressBarW32 interface.
//=============================================================================
MAXSI_CLASSLINK MaxsiProgressBarW32 : public MaxsiBaseControlW32
{
	MAXSI_DECLARE_IMPLEMENTATION(MaxsiProgressBarW32, MaxsiWindow, MAXSI_INTERFACE_DYNAMIC);

public:
	MaxsiProgressBarW32();
	virtual ~MaxsiProgressBarW32();

public:
	virtual MaxsiError Initialize(MaxsiWindow* Parent, MESTR* ClassName, int Width, int Height, int Left, int Top, MESTR* Title) MAXSI_INTERFACE;
	virtual MaxsiError Become(MaxsiWindow* NewSelf) MAXSI_INTERFACE;
	virtual MaxsiError SetProgress(float Progress, int Type) MAXSI_INTERFACE;
	virtual MESTR* GetControlType() MAXSI_INTERFACE;
	
};

MAXSI_LINK int Debug(char* String);
MAXSI_LINK int CriticalMsgBox(MaxsiHandle Parent, int Flags, MESTR* ErrorMessage, MESTR* ErrorTitle);

EndMaxsiNamespace

#endif

